﻿
Partial Class Default2
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        'GridView1.DataBind()
        'If ChkProgramRight(TextBox1.Text) Then
        '    ShowMessage("有權限")
        'Else
        '    ShowMessage("無權限")
        'End If
        Response.Write("OK" + Now.ToString)
    End Sub

    Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
        Response.Redirect("~/Default.aspx")
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            'Dim plh As PlaceHolder = New PlaceHolder()
            'plh.ID = "plh001"
            'Me.Controls.AddAt(0, plh)
            Dim btn As LinkButton = New LinkButton()
            btn.EnableViewState = True
            btn.Text = "TestAdd"
            btn.ID = "btn003"
            btn.Attributes("onClick") = "javascript:__MydoPostBack('" + Button1.ClientID + "','');return false "
            Panel1.Controls.AddAt(0, btn)

        End If
 
        Dim sb As StringBuilder = New StringBuilder()
        sb.AppendLine("<script type=""text/javascript"">")
        sb.AppendLine("//<![CDATA[")
        sb.AppendLine("var theForm = document.forms['form1'];")
        sb.AppendLine("if (!theForm) {")
        sb.AppendLine("    theForm = document.form1;")
        sb.AppendLine("}")
        sb.AppendLine("function __MydoPostBack(eventTarget, eventArgument) {")
        sb.AppendLine("    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {")
        sb.AppendLine("        theForm.__EVENTTARGET.value = eventTarget;")
        sb.AppendLine("        theForm.__EVENTARGUMENT.value = eventArgument;")
        sb.AppendLine("        theForm.submit();")
        sb.AppendLine("    }  } //]]> </script>")
        Page.ClientScript.RegisterClientScriptBlock(GetType(Default2), "PopForm", sb.ToString())



    End Sub
End Class
